package com.jiuqi.bi.server.bsp.tagmanagement.manager;

import com.jiuqi.bi.BIException;
import com.jiuqi.bi.dblib.DBConnection;
import com.jiuqi.bi.runtime.bsp.exception.BSPException;
import com.jiuqi.bi.server.bsp.tagmanagement.dao.TagItemDao;
import com.jiuqi.bi.server.bsp.tagmanagement.listener.TagEventTypeEnum;
import com.jiuqi.bi.server.bsp.tagmanagement.listener.TagNotifyCenter;
import com.jiuqi.bi.server.bsp.tagmanagement.model.TagItem;
import com.jiuqi.bi.server.bsp.tagmanagement.utils.TagDataBaseUtils;
import com.jiuqi.bi.server.bsp.tagmanagement.utils.TagItemSortUtils;
import com.jiuqi.bi.server.bsp.ualog.dao.TagTypeDao;
import com.jiuqi.bi.server.bsp.ualog.model.TagType;
import com.jiuqi.bi.util.OrderGenerator;
import com.jiuqi.bi.util.StringUtils;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class TagManager {


    /**
     * 将所有含有字母的标签编码全部转为大写
     * @param conn
     * @throws Exception
     */
    public void capitalizeLCodeField(Connection conn)throws Exception {
            Set<String> letterTagCodeSet = TagItemDao.queryAllLetterTagCodes(conn);
            Map<String, String> letterTagCodeMap = letterTagCodeSet.stream()
                                                                   .collect(Collectors.toMap(Function.identity(), String::toUpperCase));
            TagItemDao.modifyAllLetterTagCodes(conn, letterTagCodeMap);
    }
}
